<template>
  <div class="number-card">
    <div class="card-content">
      <div class="number-display">{{ formattedNumber }}</div>
      <div class="card-title">{{ title }}</div>
    </div>
    <div class="card-glow"></div>
  </div>
</template>

<script setup lang="ts">
import { computed } from 'vue'

interface Props {
  number: number
  title: string
  color?: string
}

const props = withDefaults(defineProps<Props>(), {
  color: '#ffff00'
})

// 格式化数字，添加分隔符
const formattedNumber = computed(() => {
  return props.number.toLocaleString()
})
</script>

<style scoped>
.number-card {
  position: relative;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(255, 255, 0, 0.8);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transition: all 0.3s ease;
}

.number-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(255, 255, 0, 0.3);
}

.card-content {
  position: relative;
  z-index: 2;
}

.number-display {
  font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
  font-size: 48px;
  font-weight: bold;
  color: #ffff00;
  text-shadow: 
    0 0 10px #ffff00,
    0 0 20px #ffff00,
    0 0 30px #ffff00;
  margin-bottom: 8px;
  letter-spacing: 2px;
  animation: numberGlow 2s ease-in-out infinite alternate;
}

.card-title {
  font-size: 16px;
  color: #fff;
  font-weight: 500;
  opacity: 0.9;
}

.card-glow {
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, 
    transparent, 
    rgba(255, 255, 0, 0.1), 
    transparent, 
    rgba(255, 255, 0, 0.1), 
    transparent);
  border-radius: 8px;
  z-index: 1;
  animation: borderGlow 3s linear infinite;
}

@keyframes numberGlow {
  0% {
    text-shadow: 
      0 0 10px #ffff00,
      0 0 20px #ffff00,
      0 0 30px #ffff00;
  }
  100% {
    text-shadow: 
      0 0 15px #ffff00,
      0 0 25px #ffff00,
      0 0 35px #ffff00,
      0 0 45px #ffff00;
  }
}

@keyframes borderGlow {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

/* 数字跳动动画 */
.number-display {
  animation: numberGlow 2s ease-in-out infinite alternate,
             numberPulse 1s ease-in-out infinite;
}

@keyframes numberPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .number-display {
    font-size: 36px;
  }
  
  .card-title {
    font-size: 14px;
  }
  
  .number-card {
    padding: 15px;
  }
}

@media (max-width: 480px) {
  .number-display {
    font-size: 28px;
  }
  
  .card-title {
    font-size: 12px;
  }
  
  .number-card {
    padding: 12px;
  }
}
</style>
